﻿using CRMBiz;
using CRMWeb.Utilities.Context;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CRMWeb.Pages.AM.EzidebitService
{
    public partial class CreateSchedule : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                EziDebitService ezidebitservice = new EziDebitService();
                string response = ezidebitservice.createSchedule(WebConfigurationManager.AppSettings["EziDebitDigitalKey"], txtYourSystemReference.Text, txtScheduleStartDate.Text, txtSchedulePeriodType.Text, txtDayOfWeek.Text, int.Parse(txtDayOfMonth.Text), txtFirstWeekOfMonth.Text, txtSecondWeekOfMonth.Text, txtThirdWeekOfMonth.Text, txtFourthWeekOfMonth.Text, long.Parse(txtPaymentAmountInCents.Text), int.Parse(txtLimitToNumberOfPayments.Text), long.Parse(txtLimitToTotalAmountInCents.Text), txtKeepManualPayments.Text, txtUsername.Text);
                lblMsg.Text = response;
            }
            catch (Exception ex)
            {
                ErrorHandler.saveErrorLog(ex, CMSContext.CurrentUser.MemberName);
            }
        }
    }
}